package com.util;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;
import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;

import com.manager.commons.StringUtil;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class MD5JFrame extends javax.swing.JFrame  implements ActionListener{
	private JPanel jPanel1;
	private JButton jButton2;
	private JButton jButton1;
	private JTextField jTextField1;
	private JLabel jLabel2;
	private JTextField mima;
	private JLabel jLabel1;
	StringUtil strUtil = new StringUtil();
	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				MD5JFrame inst = new MD5JFrame();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public MD5JFrame() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			{
				jPanel1 = new JPanel();
				GroupLayout jPanel1Layout1 = new GroupLayout((JComponent)jPanel1);

				getContentPane().add(jPanel1, BorderLayout.NORTH);
				jPanel1.setLayout(jPanel1Layout1);
				jPanel1.setPreferredSize(new java.awt.Dimension(392, 174));
				{
					jLabel1 = new JLabel();
					jLabel1.setText("\u8f93\u5165\u5bc6\u7801\uff1a");
				}
				{
					mima = new JTextField();
				}
				{
					jLabel2 = new JLabel();
					jLabel2.setText("\u67e5\u770b\u7ed3\u679c\uff1a");
				}
				{
					jTextField1 = new JTextField();
				}
				{
					jButton1 = new JButton();
					jButton1.addActionListener(this);
					jButton1.setText("\u8ba1\u7b97");
				}
				{
					jButton2 = new JButton();
					jButton2.addActionListener(this);
					jButton2.setText("\u5173\u95ed");
				}
					jPanel1Layout1.setHorizontalGroup(jPanel1Layout1.createSequentialGroup()
					.addContainerGap()
					.addGroup(jPanel1Layout1.createParallelGroup()
					    .addComponent(jLabel1, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jLabel2, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(19)
					.addGroup(jPanel1Layout1.createParallelGroup()
					    .addGroup(jPanel1Layout1.createSequentialGroup()
					        .addComponent(jTextField1, GroupLayout.PREFERRED_SIZE, 245, GroupLayout.PREFERRED_SIZE))
					    .addGroup(GroupLayout.Alignment.LEADING, jPanel1Layout1.createSequentialGroup()
					        .addGroup(jPanel1Layout1.createParallelGroup()
					            .addGroup(GroupLayout.Alignment.LEADING, jPanel1Layout1.createSequentialGroup()
					                .addGap(24)
					                .addComponent(jButton2, GroupLayout.PREFERRED_SIZE, 159, GroupLayout.PREFERRED_SIZE))
					            .addGroup(GroupLayout.Alignment.LEADING, jPanel1Layout1.createSequentialGroup()
					                .addComponent(mima, GroupLayout.PREFERRED_SIZE, 178, GroupLayout.PREFERRED_SIZE)
					                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)))
					        .addComponent(jButton1, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE)))
					.addContainerGap(56, Short.MAX_VALUE));
					jPanel1Layout1.setVerticalGroup(jPanel1Layout1.createSequentialGroup()
					.addContainerGap()
					.addGroup(jPanel1Layout1.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(mima, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jButton1, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jLabel1, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(18)
					.addGroup(jPanel1Layout1.createParallelGroup()
					    .addComponent(jTextField1, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
					    .addGroup(GroupLayout.Alignment.LEADING, jPanel1Layout1.createSequentialGroup()
					        .addComponent(jLabel2, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					        .addGap(7)))
					.addGap(48)
					.addComponent(jButton2, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
					.addContainerGap(22, Short.MAX_VALUE));
			}
			{

			}

			pack();
			this.setSize(400, 211);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	public void actionPerformed(ActionEvent e) {
		if (e.getSource() == null) {

		} else {
			if (e.getSource() == jButton1) {
				String ma = strUtil.MD5Encode(mima.getText());
				jTextField1.setText(ma);
			}
			if (e.getSource() == jButton2) {
				System.exit(1);
			}
		}
	}


}
